#ifndef __WIZ_BNF_PARSER_CHAR_HPP__SHANHAOBO_19800429__
#define __WIZ_BNF_PARSER_CHAR_HPP__SHANHAOBO_19800429__

#include "./WizBNFParser.hpp"

namespace Wiz
{
    namespace BNF
    {
        namespace Parser
        {
            namespace Char
            {
                template <typename DerivedT>
                struct Type : public ::Wiz::BNF::Parser::Type<DerivedT>
                {
                    typedef DerivedT tThis;

                    template <typename ScannerT>
                    struct Result
                    {
                        typedef typename ::Wiz::BNF::Match::Result<
                            ScannerT,
                            typename ScannerT::tValue
                        >::tType tType;
                    };

                    template <typename ScannerT>
                    typename ::Wiz::BNF::Parser::Result<tThis, ScannerT>::tType
                    ParseImpl(ScannerT const& Scan) const
                    {
                        typedef ::Wiz::BNF::Parser::Result<tThis, ScannerT>::tType  tResult;
                        typedef typename ScannerT::tValue                           tValue;
                        typedef typename ScannerT::tIterator                        tIterator;
                        
                        if (Scan.AtEnd() == ::Wiz::Bool::False)
                        {
                            tValue Chr = *Scan;
                            if (this->Derived().Test(Chr))
                            {
                                tIterator StartItr(Scan.m_Curr);
                                ++(Scan.m_Curr);
                                return Scan.CreateMatch(1, Chr, StartItr, Scan.m_Curr);
                            }
                        }
                        return Scan.NoMatch();
                    }
                }; /// end of struct Type
            } /// end of namespace Char
        } /// end of namespace Parser
    } /// end of namespace BNF
} /// end of namespace Wiz

#endif /*__WIZ_BNF_PARSER_CHAR_HPP__SHANHAOBO_19800429__*/
